package com.qyhl.webtv.module_circle.circle.detail;


import com.qyhl.webtv.commonlib.entity.circle.CircleHomeBean;

import java.util.List;

/**
 * Created by qyhl on 2018/1/29.
 */

public class CircleDetailPresenter implements CircleDetailContract.CircleDetailPresenter {
    private CircleDetailActivity mView;

    private CircleDetailModel mModel;

    public CircleDetailPresenter(CircleDetailActivity mView) {
        this.mView = mView;
        this.mModel = new CircleDetailModel(this);
    }

    @Override
    public void getDetail(String topicId) {
        mModel.getDetail(topicId);
    }

    @Override
    public void getComment(String topicId, String lastId) {
        mModel.getComment(topicId, lastId);
    }

    @Override
    public void doFollow(String dstUserName) {
        mModel.doFollow(dstUserName);
    }

    @Override
    public void doLove(String topicId) {
        mModel.doLove(topicId);
    }

    @Override
    public void undoLove(String topicId) {
        mModel.undoLove(topicId);
    }

    @Override
    public void setComment(List<CircleHomeBean.PostList> beanList) {
        mView.setComment(beanList);
    }

    @Override
    public void setDetail(CircleHomeBean bean) {
        mView.setDetail(bean);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.setError(msg);
                break;
            case 2:
                mView.setCommentError(msg);
            default:
                break;
        }
    }

    @Override
    public void followSuccess(String msg) {
        mView.followSuccess(msg);
    }

    @Override
    public void followError(String msg) {
        mView.followError(msg);
    }

    @Override
    public void doLoveSuccess() {
        mView.doLoveSuccess();
    }

    @Override
    public void doLoveError(String msg) {
        mView.doLoveError(msg);
    }

    @Override
    public void undoLoveSuccess() {
        mView.undoLoveSuccess();
    }

    @Override
    public void undoLoveError(String msg) {
        mView.undoLoveError(msg);
    }

    @Override
    public void sendMessage(String topicId, String content, String dstUsername) {
        mModel.sendMessage(topicId, content, dstUsername);
    }

    @Override
    public void commentSuccess(String msg, int code) {
        mView.commentSuccess(msg, code);
    }

    @Override
    public void commentError(String msg) {
        mView.commentError(msg);
    }

    @Override
    public void deleteComment(String postId) {
        mModel.deleteComment(postId);
    }

    @Override
    public void deleteSuccess() {
        mView.deleteSuccess();
    }

    @Override
    public void deleteError(String msg) {
         mView.deleteError(msg);
    }

    @Override
    public void deleteTopic(String topic) {
        mModel.deleteTopic(topic);
    }

    @Override
    public void deleteTopicSuccess() {
       mView.deleteTopicSuccess();
    }

    @Override
    public void deleteTopicError(String msg) {
       mView.deleteTopicError(msg);
    }

    @Override
    public void checkShield(String dstUsername) {
        mModel.checkShield(dstUsername);
    }

    @Override
    public void checkResult(int code, String msg) {
        switch (code) {
            case 0:
                mView.checkUnPass(msg);
                break;
            case 1:
                mView.checkPass();
                break;
            default:
                break;
        }
    }
}
